package com.taiyuan.tongcheng.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.taiyuan.tongcheng.bean.BaseOrder;
import com.taiyuan.tongcheng.bean.BjOrderInfo;
import com.taiyuan.tongcheng.bean.ZcOrderInfo;
import com.taiyuan.tongcheng.ui.MovingActivity;


public class TcUtil {
    public static String getApiName(String api) {
        return api.substring(api.lastIndexOf("/")+1, api.length());
	}
    //判断手机格式是否正确
	public static boolean isMobileNO(String mobiles) {
		Pattern p = Pattern
				.compile("^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");
		Matcher m = p.matcher(mobiles);
		return m.matches();
	}
    
	//支付价格判断
	 /**
	  * 
	 * @Description: 
	 * @param info
	 * @return
	 * @return int 0 未支付  1支付全部  
	 * @throws
	 * @autour wzq
	 * @date 2015-9-22 下午4:45:07
	 * @update (date)
	  */
     public static int getMovingPay(BjOrderInfo  info){
    	 if(info.getIsPayFlag()==0){
    		 if(info.getAlreadyPayMoney()>0){
    			 return OrderPayState.PAY_PART;
    		 }else{
    			 return OrderPayState.PAY_NULL;
    		 }
    	 }
    	 
    	 if(info.getIsPayFlag()==1){
    		 return OrderPayState.PAY_ALL;
    	 }
    	 
    	 return OrderPayState.PAY_NULL;
     }
     
     /**
      * 
     * @Description:
     * @param info
     * @return OrderPayState
     * @return int
     * @throws
     * @autour wzq
     * @date 2015-9-22 下午4:56:33
     * @update (date)
      */
     public static int getCargoPay(ZcOrderInfo info){
    	 if(info.getIsPayFlag()==0){
    		 return OrderPayState.PAY_NULL;
    	 }
    	 
    	 if(info.getIsPayFlag()==1){
    		 return OrderPayState.PAY_ALL;
    	 }
    	 return OrderPayState.PAY_NULL;
     }
     
     public class  OrderPayState{
    	 /**已支付***/
    	 public static final int  PAY_ALL =3 ;
    	 /**未支付***/
    	 public static final int  PAY_NULL =1 ;
    	 /**支付一部分***/
    	 public static final int  PAY_PART =2 ;
     }
	
}
